@echo off

Rem ******NOTICE******
Rem MUST set SDK_PATH & BIN_PATH firstly!!!
Rem example:
Rem set SDK_PATH=/c/esp_iot_sdk_freertos
Rem set BIN_PATH=/c/esp8266_bin

set SDK_PATH=/c/Espressif/ESP8266_RTOS_SDK
set BIN_PATH=./bin

echo build.bat version 20180313
echo.

if not %SDK_PATH% == "" (
    echo SDK_PATH: %SDK_PATH%
) else (
    echo ERROR: Please set SDK_PATH in gen_misc.bat firstly, exit!!!
    goto end
)

if not %BIN_PATH% == "" (
    echo BIN_PATH: %BIN_PATH%
) else (
    echo ERROR: Please set BIN_PATH in gen_misc.bat firstly, exit!!!
    goto end
)

set boot=new
set app=1
set spi_speed=40
set spi_mode=DIO
set spi_size_map=6

echo.
echo boot mode: %boot%
echo app: %app%
echo spi speed: %spi_speed% MHz
echo spi mode(QIO, QOUT, DIO, DOUT): %spi_mode%
echo flash size and map:
echo     0= 512KB( 256KB+ 256KB)
echo     2=1024KB( 512KB+ 512KB)
echo     3=2048KB( 512KB+ 512KB)
echo     4=4096KB( 512KB+ 512KB)
echo     5=2048KB(1024KB+1024KB)
echo     6=4096KB(1024KB+1024KB)
echo spi_size_map: %spi_size_map%

echo.
echo start...
echo.

make clean

make COMPILE=gcc BOOT=%boot% APP=%app% SPI_SPEED=%spi_speed% SPI_MODE=%spi_mode% SPI_SIZE_MAP=%spi_size_map%

:end